/**
 * This file is part of the CAKIS project.
 * 
 * Copyright (c) 2009-2010 - Florian Arndt, Christian Kerl
 * 
 * @license GNU Lesser General Public License v3 <http://www.opensource.org/licenses/lgpl-3.0.html>
 * @since   06.05.2010
 * @version SVN: $Id: AbstractForm.java 110 2010-05-06 20:28:18Z f.aarndt@web.de $
 */

package org.cakis.client.forms;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;

import org.cakis.client.CakisMIDlet;
import org.cakis.client.commands.AbstractCommand;
import org.cakis.client.commands.ExitCommand;

/**
 * AbstractForm
 *
 * @author Florian Arndt
 */
public class AbstractForm extends Form implements CommandListener {

	public AbstractForm(String title, CakisMIDlet midlet) {
		super(title);
		this.addCommand(new ExitCommand(midlet));
		this.setCommandListener(this);		
	}

	public void commandAction(Command command, Displayable displayable) {
		AbstractCommand abstractCommand = (AbstractCommand) command;
		abstractCommand.execute();
	}
}
